package com.glw.sso.platform.web.config;

import com.glw.sso.platform.web.interceptor.LogInterceptor;
import com.glw.sso.platform.web.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: guoliwei
 * @Date: 2021/11/14 19:57
 * @Version 1.0
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer{

    @Autowired
    LoginInterceptor loggerInterceptor;

    @Autowired
    LogInterceptor logInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor).addPathPatterns("/**");
        registry.addInterceptor(loggerInterceptor).addPathPatterns("/api/**").addPathPatterns("/logout");
    }
}
